<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>  
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>  
<%@ taglib uri="/tags/struts-nested" prefix="nested" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>  

<html>  
   <head> 
         <meta name="Generator" content="Easy Struts Xslt generator for Eclipse."> 
         <title>News management !</title> 
   </head> 
  	 <body> 
	<center>
  	 	   	 	
  	 <H1> GLRE 2011 : News management 
    	<logic:present 	name="user" property="login" scope="session" >  
      		<bean:write name="user" property="login" scope="session"/>  
      	</logic:present>
   	</H1> 
   
		<html:form action= "/news" focus="news">
			<html:hidden property="methodToCall" value ="add"/>
			
			Title : <html:text property="title"/> 
					<html:errors property="title"/> <br> 
			Category : 	<html:select property="categoryId">
							<html:optionsCollection property="categories" value="categoryId" label="categoryName"/>
						</html:select>
				<html:errors property="category"/><br> 
			Content : <html:textarea property="content"></html:textarea>	
				<html:errors property="content"/><br> 			
			<html:submit/><html:reset/> 
		
		<br><br>
			<table class="userTable" cellpadding="5px">
				<tr class="even">	
					<th>Date</th>				
					<th>Author</th>				
					<th>Category</th>	
					<th>Title</th>					
					<th>Content</th>							
				</tr>
				
			<nested:iterate property="newsList">
				<TR>
					<TD><nested:write property="date"/></TD>
					<TD><nested:write property="author"/></TD>
					<TD><nested:write property="category"/></TD>
					<TD><nested:write property="title"/></TD>
					<TD><nested:write property="content"/></TD>
					
					<TD><A HREF="./news.do?newsId=<nested:write property='id'/>&methodToCall=edit&actionType=edit"><html:img src="images/edit.jpg"/></A></TD>
					<TD><A HREF="./news.do?newsId=<nested:write property='id'/>&methodToCall=delete&actionType=delete"><html:img src="images/delete.jpg"/></A></TD>
				</TR>
			</nested:iterate>			
			
			</table>
						
		</html:form>
		</center>
	</body> 
</html>